<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>
<script type="text/javascript" src="<c:url value='/common/js/jquery-1.7.1.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/jquery-ui-1.8.16.custom.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/jquery-popup.0.2.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/ajaxupload.js'/>"></script>
<script type="text/javascript" src="<c:url value='/common/js/Common.js'/>"></script>
<script type="text/javascript" src="/kr/common/js/pie/pie_ready.js"></script>
<script>

function PreView(curPage1){
    

    if(curPage1 == '1') {
        alert("이전페이지가 없습니다.");
        return ;
    }
    var srcCon = document.getElementById("hidSelSearchCon") ;
    var srcNm  = document.getElementById("hidConName");    
    var curPage = document.getElementById("curPage");
    

    
    var curPage = document.getElementById("pageIndex");
    

    curPage.value = (curPage1 - 1) ;
     
    
    var form = document.qaListForm;
    form.action = "<c:url value='/mpg/QAListPaging.do'/>";
    form.submit();  
   
   
}

function NextView(curPage1){
    

    
    var totalPage = document.getElementById("totalPage");

    if(curPage1 >= totalPage.value){
        alert("다음 페이지가 없습니다.");
        return ;       
    }

    
    var curPage = document.getElementById("pageIndex");
   

    curPage.value = (curPage1 + 1) ;
     
    
    var form = document.qaListForm;
    form.action = "<c:url value='/mpg/QAListPaging.do'/>";
    form.submit();  
   
}

function qaPageView(){
    var TotalRow = document.getElementById("totalRow");
    var inPageHTML = "";
    var Total = TotalRow.value ;
    var  divCnt = ${mpgSearchInfoVO.recordCountPerPage};



    if((Total % divCnt ) > 0 ){
        totalPage = Total / divCnt + 1;
    }else{
        totalPage = Total / divCnt ;
    }
     totalPage = Math.floor(totalPage);


     
     
     
    var rtnCurPage = ${mpgSearchInfoVO.pageIndex} ;
   
    inPageHTML = inPageHTML + '<input type="hidden" name="totalPage" id="totalPage" value="'+ totalPage + '">';

    if(totalPage > 1){
        
        inPageHTML = inPageHTML + '<a href="javascript:PreView(' + rtnCurPage + ')"><img src="/kr/images/common/button/btn_prev.gif" alt="이전" /></a>';  
    }
    inPageHTML = inPageHTML + '<span class="num">';
   
    for (var i = 1 ; i <= totalPage ; i++){
         
        if( i == rtnCurPage){
            inPageHTML = inPageHTML + '<a href="javascript:searchPage(' + i + ')" class="on" > ' + i + '</a>';  
        }else{
            inPageHTML = inPageHTML + '<a href="javascript:searchPage(' + i + ')"  > ' + i + '</a>';  
        }
        
   
        
    }

    inPageHTML = inPageHTML + '</span>';

    
    if(totalPage > 1){
        
        inPageHTML = inPageHTML + '<a href="javascript:NextView(' + rtnCurPage + ')"><img src="/kr/images/common/button/btn_next.gif" alt="다음" /></a>';  
    }


    document.getElementById("qaPaging").innerHTML = inPageHTML ;
    
}
function DetailView(qaSn){
    
    var qaSn1 = document.getElementById("qaSn");
    
    qaSn1.value = qaSn;
   
    var form = document.qaListForm;
    form.action = "<c:url value='/mpg/QAAswInfo.do'/>";
    form.submit();    
}

function searchPage(curPage1){
    
    var pageIndex = document.getElementById("pageIndex");

   
    pageIndex.value  = curPage1;
    
    var form = document.qaListForm;
    form.action = "<c:url value='/mpg/QAListPaging.do'/>";
    form.submit();
}

$(document).ready(function(){
    
    
    qaPageView();
    
    
    
});

</script>
</head>
<body>
<%@ include file="/WEB-INF/jsp/com/include/layerpopup.jspf" %>
<div id="wrap" class="non-subnavigation">
	<%@ include file="/WEB-INF/jsp/com/include/navi_utill_sub.jspf" %>
	<%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
	<hr />
    <%@ include file="/WEB-INF/jsp/com/include/sub_header_global03.jspf" %>
	<hr />

	<div id="container">
		<div id="subtitle-area"><div class="subtitle-area-inner">
			<%@ include file="/WEB-INF/jsp/com/include/location.jspf" %>
		</div></div>
        <form id="qaListForm" name="qaListForm"  id= "qaListForm">
        
        <input type="hidden" id="totalRow" name="totalRow" value= "${mpgSearchInfoVO.total}">
        <input type="hidden"  id="pageIndex" name="pageIndex" value ="${mpgSearchInfoVO.pageIndex}">
        <input type="hidden" id="mbrSn"  name="mbrSn" value="${mpgSearchInfoVO.mbrSn }" >
        <input type="hidden" id="qaSn"  name="qaSn" value="" >
		<div id="article">
			<ul class="mypage-navigation">
                <li><a href="<c:url value="/mpg/summeryList.do"/>"><img src="/kr/images/global_menu/navi_mypage01_out.gif" alt="나의 요약정보" /></a></li>
                <li><a href="<c:url value="/mpg/pwdCheckView.do"/>"><img src="/kr/images/global_menu/navi_mypage02_out.gif" alt="회원 정보" /></a></li>
                <li><a href="<c:url value="/mpg/QuotList.do"/>"><img src="/kr/images/global_menu/navi_mypage03_out.gif" alt="최근 견적" /></a></li>
                <li><a href="<c:url value="/mpg/ctlgListPaging.do"/>"><img src="/kr/images/global_menu/navi_mypage04_out.gif" alt="카탈로그 신청 이력" /></a></li>
                <li><a href="<c:url value="/mpg/tdaListPaging.do"/>"><img src="/kr/images/global_menu/navi_mypage05_out.gif" alt="시승 신청 이력" /></a></li>
                <li><a href="<c:url value="/mpg/mpgEvntInfoView.do"/>"><img src="/kr/images/global_menu/navi_mypage06_out.gif" alt="이벤트 참여 이력" /></a></li>
                <li><a href="<c:url value="/mpg/QAListPaging.do"/>"><img src="/kr/images/global_menu/navi_mypage07_over.gif" alt="Q&amp;A" /></a></li>
			</ul>
			<h4 class="subsection"><img src="/kr/images/title/h4_global_menu03_07.gif" alt="Q&amp;A" /></h4>
			<div class="modify-contents-wrap">
				<h5><img src="/kr/images/title/h5_global_menu03_07.gif" alt="Q&amp;A LIST" /></h5>
				<div class="boardlist-wrap">
					<table summary="번호, 신청내용, 신청일자, 상태">
					<caption>상담신청내역</caption>
					<colgroup>
						<col width="10%" />
						<col width="25%" />
						<col />
						<col width="20%" />
						<col width="15%" />
					</colgroup>
					<thead>
					<tr>
						<th scope="col">NO</th>
						<th scope="col">카테고리</th>
						<th scope="col">제목</th>
						<th scope="col">등록일자</th>
						<th scope="col">상태</th>
					</tr>
					</thead>
					<tbody>
                    <c:if test="${empty resultList }">
                        <tr><td colspan="5">
                                                                       상담 이력이 없습니다.
                        </td></tr>
                    </c:if>                    
                        <c:forEach var="result" items="${ resultList }" varStatus="status">
                            <tr>
                                
                                <td class="center"><c:out value="${result.rnum}"></c:out></td>
                                <td class="center"><c:out value="${result.qaCategory }"></c:out></td>
                                <td class="center"><a href="javascript:DetailView('${result.qaSn}')"><c:out value="${result.titl}"></c:out></a></td>
                                <td class="center"><c:out value="${ result.rgstDtm }"></c:out></td>
                                <td class="center"><c:out value="${result.trtmStNm }"></c:out></td>
      

                          </tr>
                        </c:forEach>
					</tbody>
					</table>
				</div>
				<div class="btnwrap subsection04" style="display:none">
					<span class="right">
						<a href="#"><img src="/kr/images/common/button/btn_before_join_qanda.gif" alt="2012. 8월 이전 상담이력 보기" /></a>
					</span>
				</div>
				<div class="paging subsection0" id="qaPaging">
				</div>
			</div>
		</div>
        </form>
	</div>
	<hr />
    <%@ include file="/WEB-INF/jsp/com/include/footer.jspf" %>